/*!
 * \file MediaEventSetupConnection.h
 * \brief Event which holds configuration parameters for media connection
 */

#ifndef MGW_MEDIA_EVENT_SETUP_CONNECTION_H
#define MGW_MEDIA_EVENT_SETUP_CONNECTION_H

#include "EventData.h"
#include "MediaGlobals.h"
#include "common.pb.h"

namespace tsc
{
namespace mgw
{

using ProtocolsCommon::IpAddress;

/**
 * Event which holds configuration parameters for new media connection.
 * First event handled by MediaGenerator
 */
class MediaEventSetupConnection : public common::EventData
{
public:

    MediaEventSetupConnection(
            uint32_t connectionId,
            ProtocolsCommon::IpAddress* clientIp,
            uint32_t clientMediaPort,
            uint32_t mediaItemId) :
		common::EventData(MEDIA_SETUP_CONNECTION),
		mConnectionId(connectionId),
		mClientIp(0),
		mClientMediaPort(clientMediaPort),
		mMediaId(mediaItemId)
	{
        mClientIp = new ProtocolsCommon::IpAddress(*clientIp);
	}

	virtual ~MediaEventSetupConnection()
	{
        delete mClientIp;
	}

	uint32_t getConnectionId() const
	{
		return mConnectionId;
	}

    const ProtocolsCommon::IpAddress* getClientIp() const
    {
        return mClientIp;
    }

    uint32_t getClientMediaPort() const
    {
        return mClientMediaPort;
    }

    uint32_t getMediaId() const
    {
        return mMediaId;
    }

private:
	uint32_t mConnectionId;
	ProtocolsCommon::IpAddress* mClientIp;
	uint32_t mClientMediaPort;
	uint32_t mMediaId;
};

} // namespace mgw
} // namespace tsc

#endif // MGW_MEDIA_EVENT_SETUP_CONNECTION_H
